package com.sskj.aikeeper.login;

import com.lzy.okgo.model.Response;
import com.sskj.aikeeper.login.RegisterActivity;
import com.sskj.aikeeper.presenter.BasePresenter;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.lib.http.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/06/25
 */
class RegisterPresenter extends BasePresenter<RegisterActivity> {

    public void register(String yq,String number,String code,String pwd,String tpwd) {

        httpService.register(yq,number,code,MD5Util.getFiveMd5Value(pwd),MD5Util.getFiveMd5Value(tpwd))
                .tag(this)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.registerSuccess();
                    }
                });
    }
    public void getRegisterCode(String number) {
        httpService.getCode(number,"1")
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.registerCode();
                    }
                });
    }
}
